package lab02.test17;

import java.util.Scanner;

        public class Test17 {



           public static void main(String[] args) {

               double[] a = new double[10];

               double max, min, sum = 0;

               int i;
               Scanner sc = new Scanner(System.in);

               System.out.println("请输入" + a.length + "个数");

               for (i = 0; i < a.length; i++) {

                   a[i] = sc.nextDouble();

               }

               min = max = a[0];

               for (i = 0; i < a.length; i++) {

                   max = a[i] > max ? a[i] : max;

                   min = a[i] < min ? a[i] : min;

                   sum = sum + a[i];
               }

                   for (i = 0; i < a.length; i++) {

                       if (max == a[i])

                           System.out.println("最大值max在第" + (i + 1) + "个");

                       if (min == a[i])

                           System.out.println("最小值min在第" + (i + 1) + "个");

                   }


                   System.out.println("max=" + max + " " + "min=" + min + " " + "sum=" + sum);

               }


           }


